package com.geek.javase.ch13.videodemo;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/*
 *@author wangpeng
 *2025/10/25 10:06
 *@description TODO
 */
public class OutputStreamWriterDemo1 {
    public static void main(String[] args) {
        try(
                FileOutputStream fos = new FileOutputStream("D:\\CodeFile\\igeeklearn\\testJavaSE\\src\\com\\geek\\javase\\ch13\\videodemo\\EncodingTest.txt", true);
                OutputStreamWriter osw = new OutputStreamWriter(fos,"GBK");
                //OutputStreamWriter osw = new OutputStreamWriter(fos,"UTF-8");
        ){
            osw.write("\n");
            String str = "这是一个GBK写入测试！";
            osw.write(str);
            osw.flush();
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}
